<template>
    <div>


        <!-- <div style="display: flex;justify-content:flex-end">

            <a-input-search style="width: 300px ;" placeholder="输入用户搜索订单" enter-button="Search" size="small"
                @search="onSearch" />
        </div> -->
        <!-- <a-table :columns="columns" :data-source="order" bordered>
            <template v-for="col in ['id', 'oId', 'cId', 'mTime', 'aTime', 'oType', 'userName']">
                <div :key="col">
                    <template>
                        {{ order }}
                    </template>
                </div>
            </template>

        </a-table> -->

        <a-table :columns="columns" :data-source="orderlist" bordered>

            <template v-for="col in ['id', 'oId', 'cId', 'mTime', 'aTime', 'oType', 'userName']"
                slot-scope="text, record">
                <div :key="col">
                    <template :record="orderlist.id">
                        {{ text }}
                    </template>
                </div>
            </template>
            <!-- <template slot="operation" slot-scope="text, record">
                <div :key="col" class="editable-row-operations">
                    <span>
                        <a @click="() => onDelete(record.pId)">删除</a>
                    </span>
                </div>
            </template> -->
        </a-table>

    </div>
</template>
<script>

import { mapState } from 'vuex';

const columns = [
    {
        title: '编号',
        dataIndex: 'id',
        width: '10%',
        scopedSlots: { customRender: 'id' },
    },

    {
        title: '订单编号',
        dataIndex: 'oId',
        width: '10%',
        scopedSlots: { customRender: 'oId' },
    },


    {
        title: '配送车辆',
        dataIndex: 'cId',
        width: '10%',
        scopedSlots: { customRender: 'cId' },
    },

    {
        title: '下单时间',
        dataIndex: 'mTime',
        width: '10%',
        scopedSlots: { customRender: 'mTime' },
    },

    {
        title: '预约时间',
        dataIndex: 'aTime',
        width: '10%',
        scopedSlots: { customRender: 'aTime' },
    },
    {
        title: '订单类型',
        dataIndex: 'oType',
        width: '10%',
        scopedSlots: { customRender: 'oType' },
    },
    {
        title: '下单用户',
        dataIndex: 'userName',
        width: '10%',
        scopedSlots: { customRender: 'userName' },
    },
    
    // {
    //     title: '操作',
    //     dataIndex: 'operation',
    //     width: '15%',
    //     scopedSlots: { customRender: 'operation' },
    // },

];

const data = [];

export default {
    inject: ['reload'],
   

    data() {

        return {

            data,
            columns,
            editingKey: '',

        };
    },
    mounted() {
        this.$store.dispatch('getOrderlist1')
       

    },

    computed: {
       
        ...mapState({
            orderlist: (state) => {
                return state.order.orderlist;
            },

        }),
        ...mapState({
            order: (state) => {
                return state.order.order
            }
        })

    },
    methods: {
       
        onSearch(value) {
            value && this.$store.dispatch('orderbyuser', value)
        },
        // onDelete(key) {
        //     console.log(key)
        //     this.$store.dispatch('delPath', key)
        //     this.reload();
           
       // },

    },

};
</script>
<style scoped>
.editable-row-operations a {
    margin-right: 8px;
}
</style>
